import os

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

#from google.appengine.dist import use_library
#use_library('django', '1.2')

from google.appengine.ext.webapp import template

import time
import datetime

from questions2 import *
from engine.Calendar import *

def GetInitialQuestions(person):
    qs = []
    qs.append(getQuestion("homeLocation", person))
    qs.append(getQuestion("workLocation", person))
    return qs

def GetQuestionCode(person):
    questions = []
    if person.lastQuestionsDate == None:
        questions = GetInitialQuestions(person)
    else:
        q = getQuestion("currentActivity", person)
        if q:
            questions = [q]
            

    template_values = {
        'questions': questions,
        'numberOfQuestions': len(questions)
        }

    path = os.path.join(os.path.dirname(__file__), 'questionsPane.html')
    return template.render(path, template_values)
